﻿<ResourceDictionary xmlns:my="clr-namespace:Brjnk.GpxExplorer.UI.Controls" 
                    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:l="clr-namespace:Brjnk.GpxExplorer.Localization"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <DataTemplate x:Key="WorkingAnimation">
        <Border
                    RenderTransformOrigin="0.5,0.5">
            <Border.RenderTransform>
                <RotateTransform Angle="00" />
            </Border.RenderTransform>
            <Border.Style>
                <Style TargetType="Border">
                    <Style.Triggers>
                        <EventTrigger RoutedEvent="Loaded">
                            <BeginStoryboard>
                                <Storyboard>
                                    <DoubleAnimation Timeline.DesiredFrameRate="5"
                                                         Duration="0:0:7"
                                                         From="0"
                                                         RepeatBehavior="Forever"
                                                         Storyboard.TargetProperty="RenderTransform.Angle"
                                                         To="360" />
                                </Storyboard>
                            </BeginStoryboard>
                        </EventTrigger>
                    </Style.Triggers>
                </Style>
            </Border.Style>
            <Border.Background>
                <DrawingBrush>
                    <DrawingBrush.Drawing>
                        <GeometryDrawing Brush="#FF005CFF">
                            <GeometryDrawing.Geometry>
                                <GeometryGroup>
                                    <!--  0  -->
                                    <EllipseGeometry Center="50,10"
                                                         RadiusX="9"
                                                         RadiusY="9" />
                                    <!--  45  -->
                                    <EllipseGeometry Center="78,22"
                                                         RadiusX="9"
                                                         RadiusY="9" />
                                    <!--  90  -->
                                    <EllipseGeometry Center="90,50"
                                                         RadiusX="9"
                                                         RadiusY="9" />
                                    <!--  135  -->
                                    <EllipseGeometry Center="78,78"
                                                         RadiusX="9"
                                                         RadiusY="9" />

                                    <!--  180  -->
                                    <EllipseGeometry Center="50,90"
                                                         RadiusX="9"
                                                         RadiusY="9" />
                                    <!--  210  -->
                                    <EllipseGeometry Center="22,78"
                                                         RadiusX="9"
                                                         RadiusY="9" />
                                    <!--  270  -->
                                    <EllipseGeometry Center="10,50"
                                                         RadiusX="9"
                                                         RadiusY="9" />
                                    <!--  300  -->
                                    <EllipseGeometry Center="22,22"
                                                         RadiusX="9"
                                                         RadiusY="9" />
                                </GeometryGroup>
                            </GeometryDrawing.Geometry>
                        </GeometryDrawing>
                    </DrawingBrush.Drawing>
                </DrawingBrush>
            </Border.Background>
        </Border>
    </DataTemplate>
    <Grid Background="#AAFFFFFF"  x:Key="BackgroundOperationsPanel" IsHitTestVisible="False">
        <Grid.Style>
            <Style TargetType="Grid">
                <Style.Triggers>
                    <DataTrigger Binding="{Binding BackgroundOperationList.VisibleOperations.Count}" Value="0">
                        <Setter Property="Visibility" Value="Collapsed" />
                    </DataTrigger>
                </Style.Triggers>
            </Style>
        </Grid.Style>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <StackPanel Orientation="Horizontal">
            <ContentControl HorizontalAlignment="Left" ContentTemplate="{StaticResource WorkingAnimation}" Width="30" Height="30" />
            <TextBlock Grid.Column="1"
                       Margin="10 0 0 0"
                       HorizontalAlignment="Left"
                       FontSize="20"
                       Foreground="#FF005CFF"
                       Text="{l:Loc working}" />
        </StackPanel>
        <ItemsControl Grid.Row="1" Margin="3" ItemsSource="{Binding BackgroundOperationList.VisibleOperations}">
            <ItemsControl.ItemTemplate>
                <DataTemplate>
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto" />
                            <ColumnDefinition Width="*" />
                        </Grid.ColumnDefinitions>
                        <my:LocalizedTextBlock VerticalAlignment="Bottom" FontSize="10" FontWeight="Bold"                                     StringKey="{Binding NameLocalizationKey}" Argument="{Binding Name}" />
                        <my:LocalizedTextBlock VerticalAlignment="Bottom" Grid.Column="1" Margin="5 0 0 0"  HorizontalAlignment="Right"       StringKey="{Binding InfoLocalizationKey}" Argument="{Binding Info}" />
                        <my:LocalizedTextBlock VerticalAlignment="Bottom" Grid.Row="1" FontSize="8.5" Grid.ColumnSpan="2" Foreground="Black" StringKey="{Binding LongInfoLocalizationKey}" Argument="{Binding LongInfo}" />
                        <Border Margin="5 2 5 2" Grid.Row="2" Grid.ColumnSpan="2" HorizontalAlignment="Stretch" Height="1" BorderThickness="0" Background="#FF005CFF" />
                    </Grid>
                </DataTemplate>
            </ItemsControl.ItemTemplate>
        </ItemsControl>
    </Grid>
</ResourceDictionary>